package org.jeecg.modules.internship.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.text.SimpleDateFormat;
import java.util.Date;

import java.io.Serializable;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelVerify;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.*;

/**
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-10-21 19:51
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Internship对象", description = "实习生基本信息表")
@TableName(value = "sci_internship")
public class Internship implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

//    @Excel(name="头像",width=25,type=2,dicCode="icon")
    @ApiModelProperty(value = "实习生照片")
    private String icon;


//    @Excel(name="姓名",width = 15,dicCode="name")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^[\u4e00-\u9fa5]{0,5}",message = "名字必须为汉字")
    @Size(min=2,max=5,message = "{internship.nameMsg}")
    @ApiModelProperty(value = "名字")
    private String name;

//    @Excel(name = "拼音账号",width = 20,dicCode="douyin")
    @ApiModelProperty(value = "拼音账号")
    private String douyin;

//    @Excel(name = "性别" ,width = 10,replace={"男生_1","女生_2"},dicCode="sex")
    @NotNull(message = "{internship.nullMsg}")
    @Max(value = 2,message = "{internship.sexMsg}")
    @Min(value = 1,message = "{internship.sexMsg}")
    @ApiModelProperty(value = "性别 1（男）2（女）")
    private Integer sex;

//    @Excel(name = "身份证号",width = 25,dicCode="s_Id")
    @Pattern(regexp = "(^\\d{18}$)|(^\\d{15}$)",message = "{internship.sfzMsg}")
    @ApiModelProperty(value = "身份证号")
    @TableField("s_Id")
    private String sfzId;

//    @Excel(name = "出生日期",width = 20,format  = "yyyy-MM-dd",dicCode="birth_date")
    @NotNull(message = "{internship.nullMsg}")
    @Past(message = "{internship.pastMsg}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "出生日期")
    private Date birthDate;

//    @Excel(name = "年龄",width = 10,dicCode="age")
    @NotNull(message = "{internship.nullMsg}")
    @Min(value = 0,message = "{internship.ageMsg}")
    @Max(value = 200,message = "{internship.ageMsg}")
    @ApiModelProperty(value = "年龄")
    private Integer age;

//    @Excel(name = "民族",width = 15,dicCode="nation")
    @NotNull(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "民族")
    private Integer nation;

//    @Excel(name = "政治面貌",width = 15,dicCode="politics_status")
    @NotNull(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "政治面貌")
    private Integer politicsStatus;

//    @Excel(name = "银行账号",width = 25,dicCode="bank_account")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^([1-9]{1})(\\d{14}|\\d{18})$",message = "{internship.bankAccount}")
    @ApiModelProperty(value = "银行账号")
    private String bankAccount;

//    @Excel(name = "开户银行",width = 25,dicCode="open_account")
    @NotBlank(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "开户银行")
    private String openAccount;

//    @Excel(name = "实习开始时间",width = 20,format  = "yyyy-MM-dd",dicCode="start_date")
    @NotNull(message = "{internship.nullMsg}")
    @Past(message = "{internship.pastMsg}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "实习开始时间")
    private Date startDate;

//    @Excel(name = "实习结束时间",width = 20,format  = "yyyy-MM-dd",dicCode="end_date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "实习结束时间")
    private Date endDate;

//    @Excel(name = "紧急联系人名字",width = 15,dicCode="emergency_contact")
    @NotBlank(message = "{internship.nullMsg}")
    @Size(min=2,max=5,message = "{internship.nameMsg}")
    @Pattern(regexp = "^[\u4e00-\u9fa5]{0,}$",message = "名字必须为汉字")
    @ApiModelProperty(value = "紧急联系人名字")
    private String emergencyContact;

//    @Excel(name = "紧急联系人的电话",width = 20,dicCode="emergency_phone")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "{internship.phone}")
    @ApiModelProperty(value = "紧急联系人的电话")
    private String emergencyPhone;

//    @Excel(name = "紧急联系人的邮箱",width = 25,dicCode="politics_status")
    @NotBlank(message = "{internship.nullMsg}")
    @Email(message = "{internship.emailMsg}")
    @ApiModelProperty(value = "紧急联系人的邮箱")
    private String emergencyEmail;

//    @Excel(name = "手机号",width = 20,dicCode="phone")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "{internship.phone}")
    @ApiModelProperty(value = "手机号")
    private String phone;

//    @Excel(name = "QQ号",width = 20,dicCode="qq")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^[1-9][0-9]{4,14}$",message = "{internship.qq}")
    @ApiModelProperty(value = "QQ号")
    private String qq;

//    @Excel(name = "微信号",width = 20,dicCode="vx")
    @NotBlank(message = "{internship.nullMsg}")
    @Pattern(regexp = "^[a-zA-Z]{1}[a-zA-Z\\d_]{5,}$",message = "{internship.vx}")
    @ApiModelProperty(value = "微信号")
    private String vx;

//    @Excel(name = "有线网卡MAC",width = 25,dicCode="wiredMAC")
//    @NotBlank(message = "{internship.nullMsg}")
//    @Pattern(regexp = "(([a-fA-F0-9]{2}:)|([a-fA-F0-9]{2}-)){5}[a-fA-F0-9]{2}",message = "{internship.MAC}")
    @ApiModelProperty(value = "有线网卡MAC")
    @TableField("wiredMAC")
    private String wiredMAC;

//    @Excel(name = "无线网卡MAC",width = 25,dicCode="wirelessMAC")
//    @NotBlank(message = "{internship.nullMsg}")
//    @Pattern(regexp = "(([a-fA-F0-9]{2}:)|([a-fA-F0-9]{2}-)){5}[a-fA-F0-9]{2}",message = "{internship.MAC}")
    @ApiModelProperty(value = "无线网卡MAC")
    @TableField("wirelessMAC")
    private String wirelessMAC;

//    @Excel(name = "籍贯",width = 20,dicCode="native_place")
    @NotBlank(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "籍贯")
    private String nativePlace;

//    @Excel(name = "居住地",width = 25,dicCode="address")
    @NotBlank(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "居住地")
    private String address;

//    @Excel(name = "所属学校",width = 20,dicCode="school")
    @NotBlank(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "所属学校")
    private String school;

//    @Excel(name = "学历",width = 15,dicCode="education")
    @NotNull(message = "{internship.nullMsg}")
    @ApiModelProperty(value = "学历")
    private Integer education;

//    @Excel(name = "备注",width = 30,dicCode="ps")
    @ApiModelProperty(value = "备注")
    private String ps;

    @ApiModelProperty(value = "逻辑删除 1（true）已删除， 0（false）未删除")
    @TableLogic // 逻辑删除
    private Boolean isDeleted;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT) //插入数据自动封装日期
    private Date createDate;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE) //更新数据自动封装日期
    private Date updateDate;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Internship)) return false;
        Internship that = (Internship) o;
        return Objects.equals(sfzId, that.getSfzId());
    }



    @Override
    public int hashCode() {
        return Objects.hash(sfzId);
    }
}
